<template>
	<view @click="goThread(thread.tid)">
		<view class="threadList" v-if="thread.bigImg===false">
			<view class="item">
				<view class="thumb" v-if="thread.pic!='noimage'">
					<image mode="aspectFill" :src="thread.pic" class="image"></image>

				</view>
				<view :class="['right',thread.pic=='noimage'?'noimg':'']">
					<!-- <view class="user">
					<view class="avatar">
						<image mode="aspectFill" :src="thread.user.avatar" class="image"></image>
					</view>
					<view class="userInfo">
						<view class="uname">{{thread.user.author}}</view>
						<view class="t">{{thread.dateline}}</view>
					</view>
				</view> -->
					<view class="content">
						<view class="forumname"><i class="iconfont icon-huati_topic"></i>{{thread.forum.name}}</view>
						<view class="title">
							<view style="display: flex;">
								<i class="iconfont icon-toupiao" v-if="thread.special==1"></i>
								<i class="iconfont icon-huodong_huodongguanli"
									v-else-if="thread.special==4"></i>{{thread.title}}
							</view>
						</view>
						<view class="desc" v-if="thread.special!=1 && thread.special!=4">{{thread.desc}}</view>
						<view v-else-if="thread.special==1" class="vote">

							<checkbox-group>
								<label class="uni-list-cell" v-for="(item,idx) in thread.poll.data">
									<view>
										<checkbox disabled />
									</view>
									<view>{{item.polloption}}</view>
								</label>
							</checkbox-group>
						</view>
						<view v-else-if="thread.special==4" class="event">
							<div class="eventitem">
								<div class="t"><i class="iconfont icon-shijian"></i>{{thread.event.start_time}}</div>
								<div class="data"><i class="iconfont icon-lbs"></i>{{thread.event.place}}</div>
								<div class="price"><i class="iconfont icon-renminbi_o"></i>{{thread.event.cost}}</div>
								<div class="btn">
									<view class="join">参加活动</view>
								</div>
							</div>
						</view>

					</view>
					<view class="threadInfo" v-if="thread.pic!='noimage' && thread.special!=1 && thread.special!=4">
						<view class="f">
							<view class="uname">
								<view class="avatar">
									<image mode="aspectFill" :src="thread.user.avatar" class="image"></image>
								</view>
								<view class="nametext">{{thread.user.author}}</view>
							</view>
							<view class="views"><i class="iconfont icon-yueduliang"></i>{{thread.thread.views}}</view>
						</view>
					</view>
				</view>
			</view>
			<view class="threadInfo" v-if="thread.pic=='noimage'"
				style="position: unset;padding:20rpx 30rpx ;width: calc(100% - 60rpx);">
				<view class="f" style="width:100%">
					<view class="uname">
						<view class="avatar">
							<image mode="aspectFill" :src="thread.user.avatar" class="image"></image>
						</view>
						<view class="nametext">{{thread.user.author}}</view>
					</view>
					<view class="views"><i class="iconfont icon-yueduliang"></i>{{thread.thread.views}}</view>
				</view>
			</view>
		</view>
		<view v-else class="bigImg">
			<image mode="aspectFill" :src="thread.pic" class="image"></image>
			<view class="title">{{thread.title}}</view>
			<view class="imgCount" v-if="thread.imgCount>0">{{thread.imgCount}}张</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'XXL-thread',
		props: {
			thread: {
				type: Object
			},
		},
		data() {
			return {

			}
		},
		mounted() {

		},
		methods: {
			goThread(tid) {
				uni.navigateTo({
					url: '/pages/thread/viewthread?tid=' + tid
				})
			}
		}

	}
</script>
<style lang="scss" scoped>
	.uni-list-cell {
		display: flex;
		margin: 10rpx 0;
		justify-content: flex-start;

		::v-deep .uni-checkbox-input-disabled,::v-deep checkbox {
			background-color: #f6f6f6;
			&:before{
				background-color: #f6f6f6;
			}
			
		}
	}

	.forumname {
		margin: 15rpx 0;
		font-size: 24rpx;
		display: flex;
		color: #6772FF;

		.iconfont {
			margin-right: 5rpx;
		}
	}

	.bigImg {
		position: relative;
		height: 300rpx;
		margin: 40rpx 0;

		.imgCount {
			position: absolute;
			top: 20rpx;
			right: 20rpx;
			background: rgba(0, 0, 0, .6);
			color: #fff;
			font-size: 24rpx;
			padding: 5rpx 10rpx;
			border-radius: 5rpx;
		}

		.title {
			position: absolute;
			bottom: 20rpx;
			color: #fff;
			z-index: 10;
			left: 20rpx;
			font-weight: bold;
			font-size: 32rpx;

		}

		&::after {
			content: "";
			position: absolute;
			width: 100%;
			height: 100%;
			left: 0;
			bottom: 0;
			background-color: transparent;
			background: -webkit-gradient(linear, left top, left bottom, from(transparent), to(#000));
			opacity: .9;
			z-index: 9;
		}



		.image {
			padding: 0;
			margin: 0;
			width: 100%;
			height: 300rpx;
		}
	}

	.threadList {
		margin: 40rpx 0;
		background: #fff;

		.threadInfo {
			position: absolute;
			bottom: 10rpx;
			width: 100%;

			.f {
				display: flex;
				width: calc(100% - 30rpx);
				align-items: center;
				justify-content: space-between;

				.uname {

					.nametext {
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box !important;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;
					}

					.avatar {
						width: 50rpx;

						.image {
							width: 40rpx;
							height: 40rpx;
							border-radius: 40rpx;
						}
					}
				}

				.views {
					.iconfont {
						margin-right: 5rpx;
					}
				}

				.uname,
				.views {
					display: flex;
					align-items: center;
					font-size: 24rpx;
					color: #999;
				}
			}
		}

		.item {
			display: flex;

			.thumb {
				width: 50%;
				height: 400rpx;
				position: relative;


				image {
					width: 100%;
					height: 400rpx;
				}
			}

			.right {
				// padding: 10rpx;
				margin-left: 30rpx;
				width: calc(50% - 30rpx);
				height: 400rpx;
				position: relative;



				.desc {
					margin: 10rpx 0;
					color: $h2FontColor;
					opacity: .6;
					font-size: 28rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box !important;
					-webkit-line-clamp: 3;
					-webkit-box-orient: vertical;
				}

				.eventitem {
					padding: 10rpx 0;

					.data,
					.t {
						margin-bottom: 10rpx;
						font-size: 26rpx;
						color: #999;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box !important;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;

						.iconfont {
							margin-right: 5rpx;
						}
					}

					.btn {
						position: absolute;
						bottom: 20rpx;
						width: 100%;

						.join {
							background-color: #fc4c3d;
							color: #fff;
							width: 80%;
							margin: 0 auto;
							text-align: center;
							border-radius: 10rpx;
							padding: 10rpx 0;
							font-size: 26rpx;
						}
					}

					.price {
						color: #df4a34;
						font-size: 60rpx;
						text-align: center;
						font-weight: bold;

						.iconfont {
							font-weight: normal;
							font-size: 32rpx;
							color: #999;
							margni-right: 5rpx;
						}

					}
				}

				.vote {
					margin: 20rpx 0;
					border: 2rpx solid #eee;
					padding: 10rpx 20rpx;
					width: calc(100% - 44rpx);
				}

				&.noimg {
					padding: 20rpx 30rpx;
					width: 100%;
					height: auto;
					margin-left: 0;

					.content {
						width: 100%
					}

					.desc {
						-webkit-line-clamp: 5;
					}
				}
			}
		}

		.content {
			margin: 10rpx 0;

			.title {
				color: $h2FontColor;
				line-height: 50rpx;
				font-size: 36rpx;
				font-weight: bold;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box !important;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}


		}
	}
</style>